package com.example.common.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

/**
 * @author zhangW
 * @create 2024-12-10-14:34
 */
@org.springframework.web.bind.annotation.RestController
@RequestMapping("rest")
public class RestController {


    @Autowired(required = false)








    private RestTemplate restTemplate;



    @GetMapping("/call-server2-add")
    public String callServer2Add() {
        // 通过服务名称调用 server2 的 /add 接口

        return restTemplate.getForObject("http://sys/user/add", String.class);
    }

}
